package com.cj.pj.sys.dao;

import com.cj.pj.sys.pojo.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import javax.management.relation.Role;
import java.util.List;

@Mapper
public interface SysRoleDao {

    @Select("select * from sys_roles")
    List<SysRole>findRoles();
    List<SysRole> findPageObject(String name,int startIndex,int pageSize);
    int findRowCount(String name);
    int addRole(SysRole sysRole);
    int addRoleMenus(int roleId,int... menuIds);
    int addRoleMenu(int roleId,int menuId);
    void deleteRole(int id);
    void deleteRoleMenus(int id);
    @Select("select * from sys_roles where id=#{id}")
    SysRole findObjectById(int id);
    @Update("update sys_roles set name=#{name},note=#{note},modifiedTime=#{modifiedTime} where id=#{id}")
    void updataRole(SysRole sysRole);

}
